\(\int \frac {1}{\sec (x)+\tan (x)} \, dx\) [188]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 7, antiderivative size = 5 \[ \int \frac {1}{\sec (x)+\tan (x)} \, dx=\log (1+\sin (x)) \]

[Out]

ln(1+sin(x))

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {3238, 2746, 31} \[ \int \frac {1}{\sec (x)+\tan (x)} \, dx=\log (\sin (x)+1) \]

[In]

Int[(Sec[x] + Tan[x])^(-1),x]

[Out]

Log[1 + Sin[x]]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 2746

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^(m + (p - 1)/2)*(a - x)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& IntegerQ[(p - 1)/2] && EqQ[a^2 - b^2, 0] && (GeQ[p, -1] ||  !IntegerQ[m + 1/2])

Rule 3238

Int[((a_.) + (b_.)*sec[(d_.) + (e_.)*(x_)] + (c_.)*tan[(d_.) + (e_.)*(x_)])^(-1), x_Symbol] :> Int[Cos[d + e*x
]/(b + a*Cos[d + e*x] + c*Sin[d + e*x]), x] /; FreeQ[{a, b, c, d, e}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cos (x)}{1+\sin (x)} \, dx \\ & = \text {Subst}\left (\int \frac {1}{1+x} \, dx,x,\sin (x)\right ) \\ & = \log (1+\sin (x)) \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(16\) vs. \(2(5)=10\).

Time = 0.03 (sec) , antiderivative size = 16, normalized size of antiderivative = 3.20 \[ \int \frac {1}{\sec (x)+\tan (x)} \, dx=2 \log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right ) \]

[In]

Integrate[(Sec[x] + Tan[x])^(-1),x]

[Out]

2*Log[Cos[x/2] + Sin[x/2]]

Maple [A] (verified)

Time = 0.25 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.20

method result size
default \(\ln \left (1+\sin \left (x \right )\right )\) \(6\)
risch \(-i x +2 \ln \left (i+{\mathrm e}^{i x}\right )\) \(17\)

[In]

int(1/(sec(x)+tan(x)),x,method=_RETURNVERBOSE)

[Out]

ln(1+sin(x))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.00 \[ \int \frac {1}{\sec (x)+\tan (x)} \, dx=\log \left (\sin \left (x\right ) + 1\right ) \]

[In]

integrate(1/(sec(x)+tan(x)),x, algorithm="fricas")

[Out]

log(sin(x) + 1)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 17 vs. \(2 (5) = 10\).

Time = 0.07 (sec) , antiderivative size = 17, normalized size of antiderivative = 3.40 \[ \int \frac {1}{\sec (x)+\tan (x)} \, dx=\log {\left (\tan {\left (x \right )} + \sec {\left (x \right )} \right )} - \frac {\log {\left (\tan ^{2}{\left (x \right )} + 1 \right )}}{2} \]

[In]

integrate(1/(sec(x)+tan(x)),x)

[Out]

log(tan(x) + sec(x)) - log(tan(x)**2 + 1)/2

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 31 vs. \(2 (5) = 10\).

Time = 0.22 (sec) , antiderivative size = 31, normalized size of antiderivative = 6.20 \[ \int \frac {1}{\sec (x)+\tan (x)} \, dx=2 \, \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1\right ) - \log \left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right ) \]

[In]

integrate(1/(sec(x)+tan(x)),x, algorithm="maxima")

[Out]

2*log(sin(x)/(cos(x) + 1) + 1) - log(sin(x)^2/(cos(x) + 1)^2 + 1)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 22 vs. \(2 (5) = 10\).

Time = 0.29 (sec) , antiderivative size = 22, normalized size of antiderivative = 4.40 \[ \int \frac {1}{\sec (x)+\tan (x)} \, dx=-\log \left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right ) + 2 \, \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) + 1 \right |}\right ) \]

[In]

integrate(1/(sec(x)+tan(x)),x, algorithm="giac")

[Out]

-log(tan(1/2*x)^2 + 1) + 2*log(abs(tan(1/2*x) + 1))

Mupad [B] (verification not implemented)

Time = 24.59 (sec) , antiderivative size = 21, normalized size of antiderivative = 4.20 \[ \int \frac {1}{\sec (x)+\tan (x)} \, dx=2\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )+1\right )-\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right ) \]

[In]

int(1/(tan(x) + 1/cos(x)),x)

[Out]

2*log(tan(x/2) + 1) - log(tan(x/2)^2 + 1)